<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>WebRTC 通话</title>
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
    <div class="container">
        <header>
            <h1>WebRTC 视频通话</h1>
            <div class="user-info">
                <span id="userNameDisplay"></span>
                <button id="logoutBtn" class="btn-secondary">退出</button>
            </div>
        </header>

        <main>
            <div class="call-container">
                <div class="video-container">
                    <div class="video-wrapper">
                        <h3>本地视频</h3>
                        <video id="localVideo" autoplay muted playsinline></video>
                    </div>
                    <div class="video-wrapper">
                        <h3 id="remoteVideoTitle">远程视频</h3>
                        <video id="remoteVideo" autoplay playsinline></video>
                        <div id="remoteUserInfo" class="remote-user-info" style="display: none;">
                            <span class="user-avatar">👤</span>
                            <span class="user-name-display"></span>
                        </div>
                    </div>
                </div>

                <div class="controls">
                    <div id="callStatus" class="call-status">等待通话...</div>
                    <button id="toggleVideo" class="btn-control">关闭视频</button>
                    <button id="toggleAudio" class="btn-control">关闭音频</button>
                    <button id="hangupBtn" class="btn-hangup" disabled>挂断</button>
                </div>
            </div>

            <div class="user-list-container">
                <h3>在线用户</h3>
                <div id="userList" class="user-list">
                    <!-- 用户列表将在这里动态生成 -->
                </div>
            </div>
        </main>
    </div>

    <!-- 呼叫确认对话框 -->
    <div id="incomingCallModal" class="modal">
        <div class="modal-content">
            <h3>来电</h3>
            <p id="callerName"></p>
            <div class="modal-buttons">
                <button id="acceptCall" class="btn-accept">接听</button>
                <button id="rejectCall" class="btn-reject">拒绝</button>
            </div>
        </div>
    </div>

    <script src="js/webrtc-client.js"></script>
    <script src="js/ui.js"></script>
</body>
</html>